package com.example.usermanagement.mapper;

import com.example.usermanagement.entity.UserLog;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UserLogMapper {

    @Insert("INSERT INTO user_logs (user_id, action, timestamp) VALUES (#{userId}, #{action}, #{timestamp})")
    void insert(UserLog userLog);

    @Select("SELECT id, user_id AS userId, action, timestamp FROM user_logs")
    List<UserLog> findAll();
}